#include "internal.h"

/*
 * scheduler tick hitting a task of our scheduling class.
 *
 * NOTE: This function can be called remotely by the tick offload that
 * goes along full dynticks. Therefore no local assumption can be made
 * and everything must be accessed through the @rq and @curr passed in
 * parameters.
 */
static void task_tick_dl(struct rq *rq, struct task_struct *p, int queued)
{
    update_curr_dl(rq);

    update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 1);
    /*
     * Even when we have runtime, update_curr_dl() might have resulted in us
     * not being the leftmost task anymore. In that case NEED_RESCHED will
     * be set and schedule() will start a new hrtick for the next task.
     */
    if (hrtick_enabled_dl(rq) && queued && p->dl.runtime > 0 &&
        is_leftmost(&p->dl, &rq->dl))
        start_hrtick_dl(rq, &p->dl);
}
